<script setup>
import { useLayoutMode } from "@/hooks/useLayoutMode"
import logo from "@/assets/layouts/logo.png?url"
import logoText1 from "@/assets/login/logobg.svg?url"
// import logoText2 from "@/assets/layouts/logo-text-2.png?url"

const props = defineProps({
  collapse: {
    type: Boolean,
    default: true
  }
})

const { isTop } = useLayoutMode()
</script>

<template>
  <div class="layout-logo-container" :class="{ collapse: props.collapse, 'layout-mode-top': isTop }">
    <transition name="layout-logo-fade">
      <router-link v-if="props.collapse" key="collapse" to="/">
        <img :src="logo" class="layout-logo" />
      </router-link>
      <router-link v-else key="expand" to="/">
        <div class="item"><img :src="logoText1" class="layout-logo-text1" /> 驾驶舱管理端</div>
        <!-- <img :src="!isLeft ? logoText2 : logoText1" class="layout-logo-text" /> -->
      </router-link>
    </transition>
  </div>
</template>

<style lang="scss" scoped>
.layout-logo-container {
  position: relative;
  width: 100%;
  height: var(--v3-header-height);
  line-height: var(--v3-header-height);
  text-align: center;
  overflow: hidden;
  .layout-logo {
    display: none;
  }
  .layout-logo-text {
    height: 100%;
    vertical-align: middle;
  }
}

.layout-mode-top {
  height: var(--v3-navigationbar-height);
  line-height: var(--v3-navigationbar-height);
}

.layout-logo-text1 {
  border: 1px solid #fff;
  width: 44px;
  height: 44px;
}
.collapse {
  .layout-logo {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    display: inline-block;
  }
  .layout-logo-text {
    display: none;
  }
}
.item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Microsoft YaHei, Microsoft YaHei";
  font-weight: bold;
  font-size: 22px;
  color: #000000;
  text-align: left;
  font-style: normal;
  text-transform: none;
}
</style>
